home *** CD-ROM | disk | FTP | other *** search
Text File | 1992-11-25 | 3.3 KB | 99 lines | [TEXT/MSET] |
- NAMED TOOLBOX ACCESS
-
-
-
- CALL -- : TrapName
- Used to compile a call to a Macintosh Toolbox routine. Simply follow
- call with the name of the routine. Compilation only.
-
- GLOBAL -- addr : globalname
- When followed by the name of a Mac system global variable, leaves the
- memory location. Example: global ticks @ returns the number of ticks
- since system startup.
-
- KONST -- n : konstName
- Returns a Mac system constant. For example, konst kAEQuitApplication
- will return the event id 'quit' on the stack.
-
-
-
-
- STACK MANIPULATION FOR TOOLBOX CALLS
-
- We need the following words to make it easy to convert our Mops stack items,
- which are always 32-bit, to and from 16-bit items as required by many Mac
- Toolbox calls.
-
- I->L 16-bit-num -- 32-bit-num
- Converts the 16-bit half-cell on top of stack into a full 32-bit Mops
- cell, extending the sign bit. i->l is useful in handling the result
- from Macintosh ROM routines that return a 16-bit signed integer on the
- stack. i->l differs from Extend in that i->l pushes two bytes onto
- the stack while extending the sign, whereas extend only extends the
- sign of a 16-bit integer contained in the 32-bit cell on top of stack,
- converting it into a 32-bit signed integer. Word0, a related word,
- pushes two zero bytes onto the stack.
-
- MAKEINT 32-bit-num -- 16-bit-num
- Drops the higher 16 bits of the number on top of the stack. This is
- handy in Toolbox calls that require an Int value.
-
- W -- 16-bit-value : value
- Useful for compiling a 16 bit number for toolbox calls. Same as n
- makeint except n must be known at compilation time. More compact than
- using n makeint.
-
- WORD0 n -- 16-zero-bits
- Pushes 16 zero bits (hex 0000) onto the stack. You can use word0 to
- prepare for a Toolbox function call for the result, if the function
- returns a Toolbox integer.
-
- TBOOL b -- tbool
- Makes a Mops boolean into a Toolbox boolean. Note that tbool should
- only be used as a setup for a Toolbox call as the stack will be
- mis-aligned until the Toolbox call is done.
-
-
- PACK x y -- x:y
- Packs two 32-bit numbers into one 32-bit number. Only the lower 16
- bits of x and y are used. You can use pack to convert a coordinate
- point into a Toolbox-compatible point.
-
- UNPACK x:y -- x y
- Unpacks a Toolbox point and puts the two integers on the stack.
- Unpack is the opposite of pack.
-
-
-
-
-
- MISCELLANEOUS
-
- STR255 addr len -- ^buf255
- Converts text beginning at addr for len characters to a str255 type
- string at buf255, leaving the addr of buf255. Note that you should use
- the string right away as the next call to str255 will overwrite the
- buffer.
-
-
- :PROC -- : name
- Begins compilation of a word that to the Toolbox behaves like a Pascal
- procedure or function. You can use a :proc word when a Toolbox
- routine requires a procedural argument.
-
- ;PROC --
- Ends compilation of word defined with :proc
-
- 'TYPE -- 4bytestring : XXXX
- Given 4 ascii characters in the input stream, a 4bytestring will
- be left on the stack. This data type is also known as a PACKED
- ARRAY[1..4] OF CHAR; in Pascal.
-
- TRAP$ -- : trap#
- Compiles a toolbox trap if the Tools module is not loaded. The new
- syntax is, e.g.trap$ A9FF
-
- FDOS$ -- : trap#
- Compiles a toolbox trap for I/O if the Tools module is not loaded.
- The new syntax is, e.g.trap$ fdos$ A000
-